package com.caijin.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.caijin.common.core.domain.Result;
import com.caijin.common.core.domain.entity.TaskInfo;
import com.caijin.system.mapper.TaskInfoMapper;
import com.caijin.system.service.ITaskInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 作业信息表 服务实现类
 * </p>
 *
 * @author Peas
 * @since 2021-05-28
 */
@Service
public class TaskInfoServiceImpl extends ServiceImpl<TaskInfoMapper, TaskInfo> implements ITaskInfoService {

    @Autowired
    private TaskInfoMapper taskInfoMapper;

    @Override
    public Result postTask(TaskInfo taskInfo) {
        return taskInfoMapper.insert(taskInfo) == 1 ? Result.ok() : Result.error();
    }

    @Override
    public Result getTaskList(Long cno) {
        Result result = new Result();
        List<TaskInfo> taskInfoNotContent = taskInfoMapper.getTaskInfoNotContent(cno);
        result.data("data", taskInfoNotContent).success(true);
        return result;
    }
}
